<div class="layui-fluid">
  <div class="layui-row">
    <div class="layui-col-xs12">
      <div class="layui-card">
        <div class="layui-card-header" >增加
          <a href="http://www.layui.com/doc/modules/code.html" target="_blank">
            <!-- <span>http://www.layui.com/doc/modules/code.html</span> -->
          </a>
        </div>
        <div class="layui-card-body">

          <div  style="widows: 100%; height:300px;">
               

          <div id="mdadd" >
          
                  <div class="row " >
                      <div class="col-lg-6" style="width:50%;float: left;">
                          <div class="input-group">
                              <span class="input-group-btn">
                              <button class="btn btn-default btn-primary markdowninfo" type="button">标题</button>
                              </span>
                              <input type="text" class="form-control" v-model="blogtitle" >
                          </div>
                        </div>
          
                      <div class="col-lg-6" style="width:40%;float: left;">
                      <div class="input-group">
                          <span class="input-group-btn">
                          <button class="btn btn-default btn-primary markdowninfo" type="button">描述</button>
                          </span>
                          <input type="text" class="form-control" v-model="markdowninfo" >
                      </div>
                      </div>
          
                      <div class="col-lg-6" style="width:50%;float: left;margin-top: 20px;">
                              <div class="input-group">
                              <span class="input-group-btn">
                                  <button class="btn btn-default btn-primary category" type="button">分类</button>
                              </span>
                              <input type="text" class="form-control" v-model="category" >
                              </div>
                          </div>
          
                      <div class="col-lg-6" style="width:40%;float: left; margin-top: 20px;">
                          <div class="input-group">
                          <span class="input-group-btn">
                              <button class="btn btn-default btn-primary writetime" type="button">时间</button>
                          </span>
                          <!-- type="datetime-local"  -->
                          <input class="form-control" v-model="writetime" >
                          </div>
                      </div>
          
                      <div class="col-lg-6" style="width:90%;float: left;margin-top: 20px;">
                          <div class="input-group">
                          <span class="input-group-btn">
                              <button class="btn btn-default btn-primary mdcontent" type="button">内容</button>
                          </span>
                          <input type="text" class="form-control"  v-model="mdcontent" >
                          </div>
                      </div>
          
                  </div>
                  
              </div >

              <div id="enter" style="margin-top: 20px">
                  <button style="margin-right: 10% ;float:right; " class="btn btn-default btn-primary " onclick="addmd()">确定</button>
              </div>

        </div>
      </div>
    </div>
  </div>
</div>

<script>

var addmdvue = new Vue({
    el:'#mdadd',
    data: {
        blogtitle:"",
        markdowninfo:"",
        category:"",
        writetime:"",
        mdcontent:"",
    },
    
});

function addmd() {


    // if (addmdvue.writetime == "") {
    //   console.log("time null");
    //   layer.msg("时间要有多少点");
    //   return;
    // }
    // console.log(addmdvue.blogtitle + addmdvue.markdowninfo + addmdvue.writetime);
    // console.log(addmdvue.writetime);


    var markdown = [{
                      "blogtitle": addmdvue.blogtitle,
                      "writetime": addmdvue.writetime,
                      "markdowninfo": addmdvue.markdowninfo,
                      "category": addmdvue.category,
                      "mdcontent": addmdvue.mdcontent
                    }];

    // var urlread = "http://139.199.89.116:8080/md/getnewmd";

    // $.ajax({
    //     url:urlread,
    //     type:'GET',
    //     dataType:'json',
    //     contentType:'application/json; charset=UTF-8',
    //     success:function (data) {
    //       console.log(data);
    //     },
    //     error: function() {
    //         console.log("xsss");
    //     }

    // });

    var urlup = "localhost:8080/md/uploadmd?markdown="+"sdfsdf";
    console.log(markdown);
    // console.log(typeof(markdown) );
    // var data =JSON.parse(JSON.stringify(markdown)) ;
    // JSON.parse(data);
    // console.log(data);

    // console.log(typeof( data ));
    var s = "sdfsdfsd";
    $.ajax({
					url: urlup,
					type: "GET",
					contentType: "application/json; charset=utf-8",
					success: function(result) {
            console.log(result)
						// setTimeout(function() {
							console.log(341242)
							
						// }, 500);
					}
				});

    // $.ajax({
    //     url:urlread,
    //     type:'GET',
    //     data:JSON.stringify(markdown),
    //     contentType:'application/json; charset=UTF-8',
    //     success:function (data) {
    //         layer.msg(data);
    //     },
    //     error: function() {
    //         console.log("xsss");
    //     }

    // });

    // layer.msg("添加成功");
}

</script>
